//package com.honey.trip.producer;
//
//
//import com.google.gson.Gson;
//import CONSTANTS;
//import TRIP_CAR_ORDER_STATUS;
//import com.honey.trip.dao.*;
//import com.honey.trip.entity.*;
//import HttpJsonResult;
//import RmbToFmtRateService;
//import TripCarOrderService;
//import UserService;
//import DateUtils;
//import MD5Util;
//import UserUtils;
//import com.ning.http.util.DateUtil;
//import com.rabbitmq.client.BlockedCallback;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//import org.springframework.test.context.junit4.SpringRunner;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.StringUtils;
//import tk.mybatis.mapper.entity.Example;
//
//import javax.annotation.Resource;
//import java.math.BigDecimal;
//import java.text.SimpleDateFormat;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//
//@RunWith(SpringRunner.class)
//@SpringBootTest
//public class mobile {
//    private Logger logger = LoggerFactory.getLogger(mobile.class);
//    private Gson gson = new Gson();
//    @Resource
//    private UserDao userDao;
//    @Resource
//    private CardDao cardDao;
//    @Resource
//    private CardOrderDao cardOrderDao;
//    @Resource
//    private BannerDao bannerDao;
//
//    @Test
//    @Transactional
//    public void testMobile() {
//        User user = UserUtils.getLoginUser("e5525551cac3154876e13f23769e66fa");
//        if(null==user.getPayPassword()){
//            System.out.println("请先设置支付密码");
//        } }
////        String encryptedMobile = MD5Util.md5(MD5Util.md5("18942052347").concat("FENGMILVXING"));
////        System.out.println(encryptedMobile);
//
////        String encryptedMobile = MD5Util.md5(MD5Util.md5("13550836232").concat("FENGMILVXING"));
////        System.out.println(encryptedMobile);
//        //查询会员卡信息
////        Card card = cardDao.getCardById(0);
////        BigDecimal newMoney = new BigDecimal(1 ).divide(new BigDecimal(100));
////        System.out.println(newMoney);
////        Example example=new Example(CardOrder.class);
////        Example.Criteria criteria = example.createCriteria();
////        criteria.andEqualTo("userId",363);
////        criteria.andEqualTo("cardId",0);
////        int i = cardOrderDao.selectCountByExample(example);
////        System.out.println(i);
////        if(i>1) logger.info("[CardOrderServiceImpl.giveRookieCardError 用户体验卡大于一张请求拒绝: userId:{},cardId:{},date:{}]" , 363,card.getId(),new Date());
//
////        TripCarOrder editTripCarOrder = new TripCarOrder();
////        editTripCarOrder.setPaidHoneySugar(new BigDecimal(0.33));
////        editTripCarOrder.setStatus(TRIP_CAR_ORDER_STATUS.PAYED);
////        editTripCarOrder.setId(55);
////        tripCarOrderDao.updateByPrimaryKeySelective(editTripCarOrder);
//
////        Example example=new Example(Region.class);
////        Example.Criteria criteria = example.createCriteria();
////        criteria.andIsNotNull("userId");
////        criteria.andNotEqualTo("userId",0);
////        List<Region> regions = regionDao.selectByExample(example);
////        List<AgentDiligenceDegreeLog> agentDiligenceDegreeLogList=new ArrayList<>();
////        for (Region region : regions) {
////            AgentDiligenceDegreeLog agentDiligenceDegreeLog = teamDiligenceDegreeLogDao.getRegionDiligenceDegree(region);
////            agentDiligenceDegreeLog.setRemark(agentDiligenceDegreeLog.getRemark().concat("代理勤劳度"));
////            agentDiligenceDegreeLog.setDiligenceDegreeValue(
////                    agentDiligenceDegreeLog.getDiligenceDegreeValue().multiply(new BigDecimal(0.02)).setScale(2,BigDecimal.ROUND_HALF_UP)
////            );
////            agentDiligenceDegreeLog.setCreateTime(new Date());
////            agentDiligenceDegreeLogList.add(agentDiligenceDegreeLog);
////        }
//
////        agentDiligenceDegreeLogDao.insertList(agentDiligenceDegreeLogList);
////        for (AgentDiligenceDegreeLog agentDiligenceDegreeLog : agentDiligenceDegreeLogList) {
////            if(null!=agentDiligenceDegreeLog.getDiligenceDegreeValue() && new BigDecimal("0").compareTo(agentDiligenceDegreeLog.getDiligenceDegreeValue())>0){
////                UserWallet increasetUserWallet=new UserWallet();
////                increasetUserWallet.setUserId(agentDiligenceDegreeLog.getUserId());
////                increasetUserWallet.setDiligenceDegree(agentDiligenceDegreeLog.getDiligenceDegreeValue());
////                increasetUserWallet.setTeamDiligenceDegree(agentDiligenceDegreeLog.getDiligenceDegreeValue());
////                userWalletDao.increasetUserWallet(increasetUserWallet);
////            }
////        }
////        String sessionId = MD5Util.md5(MD5Util.md5("18363840626").concat("FENGMILVXING"));
////        System.out.println(sessionId);
//
//
////        agentDiligenceDegreeLogDao.insertList(agentDiligenceDegreeLogList);
//
//
////    String sessionId = MD5Util.md5(MD5Util.md5("15034528599").concat("FENGMILVXING"));
////        System.out.println(sessionId);
////        String sessionId = MD5Util.md5(MD5Util.md5("15808888695").concat("FENGMILVXING"));
////        System.out.println(sessionId);
////        HttpJsonResult<User> promotion = userService.promotion("378c395c2bb8c9a339d5e5722f6633d7");
////        Example example = new Example(ShoppingRebate.class);
////        Example.Criteria criteria = example.createCriteria();
////        criteria.andEqualTo("payType", 1);
////        ShoppingRebate shoppingRebates = shoppingRebateDao.selectByExample(example).get(0);
////        BigDecimal honeyRebate = shoppingRebates.getHoneyRebate();
////        BigDecimal degreeRebate = shoppingRebates.getDegreeRebate();
////        System.out.println(honeyRebate);
////        System.out.println(degreeRebate);
////
////        System.out.println(sessionId);
//
////        String checkCode = "mobile=" + "17610109703" + "&pwd=" + "123456" + "&mobile=" + "17610109703";
////        String key = MD5Util.md5_key(checkCode, "LoginPWD_FMLX");
////        System.out.println(key);
////        String pwd = MD5Util.md5_key("123456", "LoginPWD_FMLX");
////        System.out.println(pwd);
//
//
////        BigDecimal busySeason = new BigDecimal(0.1).add(new BigDecimal(1)).setScale(2,ROUND_DOWN);
////        System.out.println(busySeason);
////
////        try {
////            List<CarFloatingRatioVo> tripCarFloatingRatios = null;
////            TripCar tripCar = tripCarDao.get(7);
////            Integer cityId = tripCar.getCity();
////
////            Example startPriceExample = new Example(StartPrice.class);
////            Example.Criteria startPriceCriteria = startPriceExample.createCriteria();
////            startPriceCriteria.andEqualTo("cityId", cityId);
////            List<StartPrice> startPrices = startPriceDao.selectByExample(startPriceExample);
////            StartPrice startPrice1 = startPrices.get(0);
////
////            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
////            Integer count = 0;
////            long time1 = sdf.parse("2019-09-06 20:16:00").getTime();
////            long now = System.currentTimeMillis();
////            long boeDay = 86400000;
////            if (time1 - now < boeDay) {
////                count++;
////            }
////
////            tripCarFloatingRatios = tripCarFloatingRatioDao.getCarAndFloatingRatioByStartPricesId(startPrice1.getId());
////            for (CarFloatingRatioVo tripCarFloatingRatio : tripCarFloatingRatios) {
////                //起步价
////                BigDecimal startPrice = startPrice1.getStartPrice();
////                //每公里价格
////                BigDecimal eachKilometerPrice = startPrice1.getEachKilometerPrice();
////                //旺季上浮
////                BigDecimal busySeason = startPrice1.getBusySeason().add(new BigDecimal(1));
////                //车型上浮
////                BigDecimal floatingRatio = tripCarFloatingRatio.getFloatingRatio().add(new BigDecimal(1));
////                BigDecimal urgentOrder =new BigDecimal(1);
////                //急单上浮
////                if (count > 0) {
////                    urgentOrder = startPrice1.getUrgentOrder().add(new BigDecimal(1));
////                }
////                //每公里价格*公里数 + 起步价 = 基础价格
////                BigDecimal KMPrice = eachKilometerPrice.multiply(new BigDecimal(20)).add(startPrice);
////                //基础价格*急单上浮*旺季上浮*车型上浮   (人民币)
////                BigDecimal priceMoney = KMPrice.multiply(busySeason).multiply(urgentOrder).multiply(floatingRatio);
////                //人民币转FMT
////                BigDecimal priceFMT = rmbToFmtRateService.rmbToFmt(priceMoney);
////
////                tripCarFloatingRatio.setHoneySugarPrice(priceFMT);
////                tripCarFloatingRatio.setMoneyPrice(priceMoney);
////            }
////            for (CarFloatingRatioVo tripCarFloatingRatio : tripCarFloatingRatios) {
////                System.out.println(tripCarFloatingRatio.getMoneyPrice());
////                System.out.println(tripCarFloatingRatio.getHoneySugarPrice());
////                System.out.println(gson.toJson(tripCarFloatingRatio));
////            }
////
////        } catch (ParseException e) {
////            e.printStackTrace();
////        }
////        //TODO  手机号
////        List<String> mobiles=new ArrayList<>();
////        mobiles.add("13387699978");
////        mobiles.add("13964901041");
////        mobiles.add("13382244111");
////        mobiles.add("18003205315");
////        mobiles.add("13156345116");
////        mobiles.add("17093730630");
////        mobiles.add("19902059562");
////        mobiles.add("18199817637");
////        mobiles.add("13165379396");
////        for (String mobile : mobiles) {
////            System.out.println(mobile+"---------------------");
////            String sessionId = MD5Util.md5(MD5Util.md5(mobile).concat("FENGMILVXING"));
////            System.out.println(sessionId);
////        }
//
//
////        Example example=new Example(StartPrice.class);
////        Example.Criteria startPriceCriteria = example.createCriteria();
////        startPriceCriteria.andEqualTo("cityId",1);
////        List<StartPrice> startPrices = startPriceDao.selectByExample(example);
////        for (StartPrice startPrice : startPrices) {
////            System.out.println(startPrice.getCityId());
////        }
////        SpecSon specSon=new SpecSon();
////        specSon.setName("测试1");
////        specSonDao.insertSpecSon(specSon);
////        System.out.println(specSon.getId());
////        SpecParent specParent =new SpecParent();
////        specParent.setName("测试2");
////        specParentDao.insertSpecParent(specParent);
////        System.out.println(specParent.getId());
//
//
////        System.out.println(specSon.getId());
////        SpecParent specParent2 = specParentDao.selectByPrimaryKey(1);
//
////        Example example = new Example(SpecProduct.class);
////        Example.Criteria criteria = example.createCriteria();
////        criteria.andEqualTo("productId", "36");
////        List<SpecProduct> specProducts = specProductDao.selectByExample(example);
////
////
////        SpecProduct specProduct = specProducts.get(0);
////        String[] split1 = specProduct.getSpecParentId().split(",");
////        System.out.println(split1.length);
////
////        List<String> parent = new ArrayList<>();
////        Map<String, NameVo> AllList = new HashMap<>();
////        List<NameVo> list = new ArrayList<>();
////        Map<String, List<String>> map = new HashMap<>();
////        for (int i = 0; i < split1.length; i++) {
////            List<NameValueVo> son = new ArrayList<>();
////            NameVo nameVo = new NameVo();
////            for (SpecProduct product : specProducts) {
////
////                String[] splitParent = product.getSpecParentId().split(",");
////                parent.add(splitParent[i].split(":")[1]);
////
////                String[] split2 = product.getSpecSonId().split(",");
////                Integer count = 0;
////                for (NameValueVo s : son) {
////                    if (s.getName().equals(split2[i].split(":")[1])) {
////                        count++;
////                    }
////                }
////                if (count == 0) {
////                    NameValueVo vo = new NameValueVo();
////                    vo.setName(split2[i].split(":")[1]);
////                    vo.setValue(split2[i].split(":")[0]);
////                    son.add(vo);
////                    nameVo.setName(splitParent[i].split(":")[1]);
////                    nameVo.setValue(son);
////                }
////            }
////            list.add(nameVo);
////        }
////        Integer count = 0;
////        for (NameVo nameVo : list) {
////            AllList.put(count.toString(), nameVo);
////            count++;
////        }
////        System.out.println(gson.toJson(AllList));
////        Example exampleSon=new Example(SpecSon.class);
////        Example.Criteria criteria1=example.createCriteria();
////        criteria1.andIn("id",map.keySet());
////        List<SpecSon> specSons = specSonDao.selectByExample(exampleSon);
////        System.out.println(specSons.toString());
//
//
////        Map<String, String> allSpec = new HashMap<>();
////        Integer index = 0;
////        List<String> list1 = new ArrayList<>();
////        for (SpecProduct product : specProducts) {
////            //规格父类
////            String[] split = product.getSpecParentId().split(",");
////            for (String parent : split) {
////                //规格子类
////                String[] sons = product.getSpecSonId().split(",");
////                allSpec.put(parent, null);
////                if (index == 0) {
////                    list1.add(sons[index]);
////                }
////                index++;
////            }
////            index = 0;
////        }
////        System.out.println(list1);
////        Example exampleSon=new Example(SpecSon.class);
////        Example.Criteria criteria1=example.createCriteria();
////        criteria1.andIn("id",list1);
////        List<SpecSon> specSons = specSonDao.selectByExample(exampleSon);
////
////        allSpec.put("1",gson.toJson(specSons));
////        System.out.println(gson.toJson(allSpec));
//
//
////TODO 格式  {"颜色":["{\"id\":1,\"name\":\"碳晶黑\"}"],"存储容量":["{\"id\":5,\"name\":\"8+128G\"}"]}
////    @Test
////    @Transactional
////    public void testMobile() {
////        SpecParent specParent2 = specParentDao.selectByPrimaryKey(1);
////        Example example = new Example(SpecProduct.class);
////        Example.Criteria criteria = example.createCriteria();
////        criteria.andEqualTo("productId", "36");
////        List<SpecProduct> specProducts = specProductDao.selectByExample(example);
////        Map<String, List<String>> allSpec = new HashMap<>();
////        Integer index = 0;
////        for (SpecProduct product : specProducts) {
////            //规格父类
////            String[] split = product.getSpecParentId().split(",");
////            for (String parent : split) {
////                List<String> sonlist = new ArrayList<>();
////                //规格子类
////                SpecParent specParent = specParentDao.selectByPrimaryKey(Integer.valueOf(parent));
////                String[] sons = product.getSpecSonId().split(",");
////                SpecSon specSon = specSonDao.selectByPrimaryKey(Integer.valueOf(sons[index]));
////                sonlist.add(gson.toJson(specSon));
////                allSpec.put(specParent.getName(), sonlist);
////                index++;
////            }
////            index=0;
////            //规格子类
////            product.getSpecSonId();
////            System.out.println(gson.toJson(allSpec));
////        }
////
////    }
//
//
////        String mobile ="17610109703";
////        String pwd="";
////        String code="123456";
////        String rePwd="123456";
////        String sessionId = MD5Util.md5(MD5Util.md5("13247046803").concat("FENGMILVXING"));
////        System.out.println(sessionId);
////        String checkCode = "mobile=" + mobile + "pwd=" + pwd + "&mobile=" + mobile;
////        String key = MD5Util.md5_key(checkCode, "LoginByPWD_FMLX");
////        System.out.println(key);
//
////        String checkCode = "mobile=" + mobile + "&sessionId=" + sessionId + "&mobile=" + mobile + "&code=" + code;
////        String key = MD5Util.md5_key(checkCode, "UserMOBILEedit_FMLX");
////        System.out.println(key);
////        String checkCode = "sessionId=" + sessionId + "&code=" + code + "&mobile=" + mobile + "&rePwd=" + rePwd + "&pwd=" + pwd;
////        String key2 = MD5Util.md5_key(checkCode, "editLoginPWD_FMLX");
////        System.out.println(key2);
////        System.out.println(key2+":::"+":::"+checkCode);
//
////
////        String checkCode = "sessionId=" + sessionId + "&nickName=" + nickName + "&headImgUrl=" + headImgUrl + "&nickName=" + nickName;
//
////        //TODO 修改昵称头像
////        String nickName = "17610109703";
////        String headImgUrl = "https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83ergCgCq4KX7Egp2w5ickbMME90YWZVJJryoOrvsbpMJk9fbd1XExcQ1rtic8MicGTbSLMsicicSvZrF3tg/132";
////        String sessionId = "69bbd5cabba181fc92f02e81540608bc";
////        String checkCode = "sessionId=" + sessionId + "&nickName=" + nickName + "&headImgUrl=" + headImgUrl + "&nickName=" + nickName;
////        String key = MD5Util.md5_key(checkCode, "USEREDITimg1OrNick_FMLX");
////        System.out.println(key);
//
//}
